package org.lgh.webchatback.common;

import lombok.Data;

/**
 * @author wei-xhh
 * @date 2022-01-19
 */
@Data
public class R {
    private Integer status;
    private String message;
    private Object data;

    public R(Integer status, String message) {
        this.status = status;
        this.message = message;
    }

    public static R success() {
        return new R(200, "成功");
    }
    public static R error() {
        return new R(500, "失败");
    }
    public static R data(Object data) {
        R success = success();
        success.setData(data);
        return success;
    }

    public static R datae(Object data) {
        R error = error();
        error.setData(data);
        return error;
    }
}
